<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<meta name="decorator" content="sysDefault" />
<script type="text/javascript">
	$(document).ready(function() {
	});
	function funform(url, target) {
		window.open(url, target);
	}

	function checkAll(name) {
		var logCheckBox = document.getElementById("logCheckBox");
		var code_Values = document.getElementsByName('logCheckBox');
		if (logCheckBox.checked == true) {
			for (var i = 0; i < code_Values.length; i++) {
				code_Values[i].checked = true;
			}
		} else {
			for (var i = 0; i < code_Values.length; i++) {
				code_Values[i].checked = false;
			}
		}
	}

	function getCheckBoxVal() {
		var code_Values = document.getElementsByName('logCheckBox');
		var value = "";
		for (var i = 0; i < code_Values.length; i++) {
			if (code_Values[i].checked == true) {
				if (code_Values[i].value != "check") {
					value += code_Values[i].value + ",";
				}
			}
		}
		return value;
	}

	function delLog(job_id) {
		var value = getCheckBoxVal();
		if (value != "") {
			if (confirm("确定要删除选中数据吗?")) {
				var a = document.getElementById("delA");
				post('${contextPath}/sys/quartz/log/delLog', {id:value, job_id:job_id});
			}
		} else {
			alert("请选择要删除的数据");
		}
	}
	
	function post(URL, PARAMS) {        	//post提交
	    var temp = document.createElement("form");        
	    temp.action = URL;        
	    temp.method = "post";        
	    temp.style.display = "none";        
	    for (var x in PARAMS) {        
	        var opt = document.createElement("textarea");        
	        opt.name = x;        
	        opt.value = PARAMS[x];        
	        temp.appendChild(opt);        
	    }        
	    document.body.appendChild(temp);        
	    temp.submit();        
	    return temp;        
	}   
</script>
</head>
<body>
<form:form name="listForm" action="" modelAttribute="brand" method="post" class="form-inline" role="form">
	<div class="container-fluid">
		<div class="row">
			<div class="col-xs-12">
				<div class="panel panel-default">
					<div class="panel-heading">
						<h3 class="panel-title">
							消息列表 <a class="btn btn-default btn-sm pull-right"
								href="javascript:void(0)" onclick="history.go(-1)">返回</a> <a
								class="btn btn-default btn-sm pull-right" id="delA"
								href="javascript:void(0)" onclick="delLog('${job_id }')">删除</a>
						</h3>
					</div>
					<tags:message content="${message}" />
					<table class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th><input type="checkbox" name="logCheckBox" value="check"
									id="logCheckBox" onclick="checkAll()" /></th>
								<th>开始时间</th>
								<th>结束时间</th>
								<th>状态</th>
								<th>状态信息</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="log" items="${page.list }"   varStatus="i">
								<tr>
									<td><input type="checkbox" value="${log.id }"
										name="logCheckBox" /></td>
									<td><fmt:formatDate value="${log.startTime }"
											pattern="yyyy-MM-dd HH:mm:ss" /></td>
									<td><fmt:formatDate value="${log.endTime }"
											pattern="yyyy-MM-dd HH:mm:ss" /></td>
									<td><c:if test="${log.status == '0'}">
													成功
												</c:if> <c:if test="${log.status != '0'}">
													失败
												</c:if></td>
									<td>${log.info }</td>
									<td><a
										href="${contextPath}/sys/quartz/log/getLogByID?id=${log.id }">详细
									</a> <a
										href="${contextPath}/sys/quartz/log/delLog?id=${log.id }&job_id=${job_id }"
										onclick="return Oosp_Confirm('确认要删除该条数据吗？', this.href)">删除
									</a></td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<pager:pager pageSize="${page.pageSize}" pageNo="${page.pageNo}" url="" total="${page.total}"/>
				<script type="text/javascript" src="${staticPath}/js/list.js"></script>
				</div>
			</div>
		</div>
	</div>
</form:form>
</body>
</html>